Skip to content

Zero the output of out-of-place trmm/trsm when beta is zero - #761

Merged
maleadt merged 1 commit into
mainfrom
tb/trsm-variant-output
Nov 6, 2026
Merged

maleadt merged 1 commit into
mainfrom
tb/trsm-variant-output

Conversation

@maleadt

@maleadt maleadt commented Nov 5, 2026

Copy link
Copy Markdown
Member

Fixes the onemkl failure on the ALCF pipeline seen on #760 (ldiv! into a reversed view, test/onemkl.jl:1154), which is a real bug rather than a flaky tolerance.

Unlike gemm, the oneMKL trmm/trsm "variant" routines (C = alpha * op(A) \ B + beta * C, added in #643) don't document that C is left unread when beta == 0, and trsm does read it: NaN garbage in an uninitialized output leaks into the solution. Reproduced on an Arc A770 with a NaN-filled C: trsm! with beta = 0 returns all NaNs, trmm! happens to be fine. That breaks any ldiv!(C, UpperTriangular(A), B) into a fresh array, and the reversed-view path (blas_output solves into similar(C)), which is what the ALCF run hit when similar handed back memory holding NaNs.

The wrappers now fill! C with zeros before calling the variant with beta = 0, for trsm and, since the contract is the same, trmm. Regression tests cover the wrappers (NaN-filled C, all element types) and the mul!/ldiv! dispatch; without the fix they fail for trsm on the A770, with it the onemkl test suite passes.

Unlike gemm, the oneMKL trmm/trsm variants don't document that C is left
unread when beta is zero, and trsm does read it: NaN garbage in an
uninitialized output leaks into the solution. That broke `ldiv!(C, A, B)`
into a fresh array, and the reversed-view tests on the ALCF pipeline,
where `similar` happened to hand back memory holding NaNs.

Fill C with zeros before calling the variant with beta = 0, for trsm and,
since the contract is the same, trmm.
@maleadt
maleadt force-pushed the tb/trsm-variant-output branch from 09e808d to 4562b5e Compare November 6, 2026 09:02
@maleadt
maleadt enabled auto-merge (squash) November 6, 2026 10:13
@maleadt
maleadt disabled auto-merge November 6, 2026 10:13
@maleadt
maleadt merged commit d9dda52 into main Nov 6, 2026
4 of 5 checks passed
@maleadt
maleadt deleted the tb/trsm-variant-output branch November 6, 2026 10:13
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.82%. Comparing base (a735e80) to head (4562b5e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #761      +/-   ##
==========================================
- Coverage   87.02%   86.82%   -0.21%     
==========================================
  Files          55       55              
  Lines        5181     5124      -57     
==========================================
- Hits         4509     4449      -60     
- Misses        672      675       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant